home *** CD-ROM | disk | FTP | other *** search
- // MODULE:
- // DESCRIPTION: functions
- // FACILITY: Serif PagePlus 7
- // DATE: 20 October 1999
-
-
- var decimalPointDelimiter = ".";
- var abspath;
-
-
-
-
-
-
-
-
- // ---------------------------------------------------------------------------
- // FUNCTION: mOut()
- // DESCRIPTION: Changes the apperance of a text object to it's original
- // settings.
-
- function mOut() {
- window.event.srcElement.style.color = "black"
- window.event.srcElement.style.textDecoration = "none"
- }
-
- // ---------------------------------------------------------------------------
- // FUNCTION: mOver()
- // DESCRIPTION: Changes the apperance of a text object to a "highlighted"
- // settings.
-
- function mOver() {
- window.event.srcElement.style.color = "orange"
- window.event.srcElement.style.textDecoration = "underline"
- window.event.srcElement.style.cursor = "hand"
- }
-
- // ---------------------------------------------------------------------------
- // Returns true if string is empty or whitespace characters only.
- function isWhitespace (str)
- { var i;
-
- if (isEmpty(str)) return true;
-
- for (i = 0; i < str.length; i++) {
- // Check that current character isn't whitespace.
- var c = str.charAt(i);
- if (whitespace.indexOf(c) == -1) return false;
- }
-
- // All characters are whitespace.
- return true;
- }
-
-
- // ---------------------------------------------------------------------------
- // Returns true if character c is a digit (0 -> 9)
- function isDigit (c) {
- return ((c >= "0") && (c <= "9"))
- }
-
-
-
- // ---------------------------------------------------------------------------
- // isFloat (STRING s [, BOOLEAN emptyOK])
- //
- // True if string s is an unsigned floating point (real) number.
- //
- // Also returns true for unsigned integers. If you wish
- // to distinguish between integers and floating point numbers,
- // first call isInteger, then call isFloat.
-
- function isFloat (s)
- { var i;
- var seenDecimalPoint = false;
-
- //if (isEmpty(s))
- // if (isFloat.arguments.length == 1) return defaultEmptyOK;
- // else return (isFloat.arguments[1] == true);
-
- if (s == decimalPointDelimiter) return false;
-
- // Search through string's characters one by one
- // until we find a non-numeric character.
- // When we do, return false; if we don't, return true.
-
- for (i = 0; i < s.length; i++)
- {
- // Check that current character is number.
- var c = s.charAt(i);
-
- if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;
- else if (!isDigit(c)) return false;
- }
-
- // All characters are numbers.
- return true;
- }
-
-
- // ---------------------------------------------------------------------------
- // FUNCTION: Get_TimeDate()
- // DESCRIPTION: Gets the current time and date and formats the result into
- // a string based on HH:MM DD/MM/YEAR
-
- function Get_TimeDate() {
- var DateObj = new Date();
- var Day, Month, Year, Minutes, Hours;
-
- Day = DateObj.getDate();
- Month = DateObj.getMonth();
- Year = DateObj.getYear();
-
- Minutes = DateObj.getMinutes();
- Hours = DateObj.getHours();
-
- if (Minutes < 10) {
- Minutes = "0"+Minutes;
- }
-
- DateString = Hours +":"+ Minutes +" "+ Day +"/"+ Month +"/"+ Year;
-
- return DateString;
- }
-
- // -------------------------------------------------------------------------------------------------------
- // FUNCTION: get_absolute_path()
- // DESCRIPTION: Retrieves an absolute path to the folder where the current file is located.
- // AUTHOR: Rob Nicholls
- // CHANGES: Global variable: abspath
- // -------------------------------------------------------------------------------------------------------
- function get_absolute_path() {
- var temp, strEnd, strStart;
-
- temp = this.location.pathname;
- strEnd = temp.length;
- strStart = temp.lastIndexOf("\\");
- abspath = temp.substring(1,((temp.length)-(strEnd-strStart)));
- return;
- }
-
- // -------------------------------------------------------------------------------------------------------
- // FUNCTION: change_current_chm()
- // DESCRIPTION: Change the current URL in the browser window to the specified file, based on the value
- // of "abspath". i.e. result will be "abspath"\"Page".
- // CHANGES: this.location
- // AUTHOR: Rob Nicholls
- // -------------------------------------------------------------------------------------------------------
- function change_current_chm( Page ) {
- var temp;
-
- temp = abspath +"\\"+ Page;
- this.location = temp;
- return;
- }
-
-
- // -------------------------------------------------------------------------------------------------------
- // FUNCTION: CHMStringReference( grafix )
- // DESCRIPTION: Returns a concatanated string to a .chm and grafix in the common folder
- // CHANGES: none
- // RETURN VAL: formatted absolute path and filename.
- // AUTHOR: Rob Nicholls
- // -------------------------------------------------------------------------------------------------------
- function CHMStringReference( grafix ) {
- //var CommonCHM = "C:/Program Files/Serif/pageplus/7.0/help/common";
- var CommonCHM = theApplication.CHMDirectory;
-
- return "mk:@MSITStore:" + CommonCHM + "grafix.chm::" + grafix;
- }
-
- // -------------------------------------------------------------------------------------------------------
- // FUNCTION: CHMStringReference( grafix )
- // DESCRIPTION: Returns a concatanated string to a .chm and grafix in the common folder
- // CHANGES: none
- // RETURN VAL: formatted absolute path and filename.
- // AUTHOR: Rob Nicholls
- // -------------------------------------------------------------------------------------------------------
- function CHMPageReference( page ) {
- //var CommonCHM = "C:/Program Files/Serif/pageplus/7.0/help/common";
- var CommonCHM = theApplication.CHMDirectory;
-
- return "mk:@MSITStore:" +CommonCHM +"common.chm::/" +page;
- }
-
-
- // -------------------------------------------------------------------------------------------------------
- // FUNCTION: HideToolbarsAndTabs( void )
- // DESCRIPTION: Hides all the toolbars and tabs, except the wizard tab, within the current window
- // CHANGES: Toolbars.visiable state (boolean)
- // RETURN VAL: none.
- // AUTHOR: Rob Nicholls
- // -------------------------------------------------------------------------------------------------------
- function HideToolbarsAndTabs() {
- var WToolbars,WToolbars2;
- var ToolbarCount, c;
-
- // Hide the standard tabs
- theWindow.RulersVisible = 0;
- theWindow.StatusBarVisible = 0;
- theWindow.MenuVisible = 0;
-
- // see how many toolbars are in the window
- WToolbars = theWindow.Toolbars;
- ToolbarCount = WToolbars.Count();
-
- // Then hide them all
- for(c=0; c<(ToolbarCount+1); c++) {
- WToolbars.Item(c).visible = 0;
- }
-
- // Hide all other elements of the studio bar
- //WToolbars2 = theWindow.StudioBar;
-
- //WToolbars2.ColoursVisible = 0;
- //WToolbars2.FillsVisible = 0;
- //WToolbars2.TransparenciesVisible= 0;
- //WToolbars2.FontsVisible = 0;
- //WToolbars2.SchemesVisible = 0;
-
-
- return;
- }
-
- // -------------------------------------------------------------------------------------------------------
- // FUNCTION: ShowToolbarsAndTabs( void )
- // DESCRIPTION: Shows all the toolbars and tabs, except the wizard tab, within the current window
- // CHANGES: Toolbars.visiable state (boolean)
- // RETURN VAL: none.
- // AUTHOR: Rob Nicholls
- // -------------------------------------------------------------------------------------------------------
- function ShowToolbarsAndTabs() {
- var WToolbars;
- var ToolbarCount, c;
-
- // Show the standard tabs
- theWindow.RulersVisible = 1;
- theWindow.StatusBarVisible = 1;
- theWindow.MenuVisible = 1;
-
- // see how many toolbars are in the window
- WToolbars = theWindow.Toolbars;
- ToolbarCount = WToolbars.Count();
-
- // Then show them all
- for(c=0; c<(ToolbarCount+1); c++) {
- WToolbars.Item(c).visible = 1;
- }
-
- // Show all other elements of the studio bar
- //WToolbars = theWindow.StudioBar;
-
- //WToolbars.ColoursVisible = 1;
- //WToolbars.FillsVisible = 1;
- //WToolbars.TransparenciesVisible = 1;
- //WToolbars.FontsVisible = 1;
- //WToolbars.SchemesVisible = 1;
-
-
- return;
- }
-
-
-
-